<template>
	<view class="reservationInfo-page">
		<z-paging ref="paging">
			<view slot="top">
				<view class="courses-info">
					<image :src="coursePreDetail.image" class="item-left"></image>
					<view class="item-right">
						<view class="courses-title">{{coursePreDetail.name}}</view>
						<view class="courses-surplus">已预约次数：<text
								style="color: #A3C616;">{{coursePreDetail.pre_sum}}</text></view>
					</view>
				</view>
				<view class="reservationInfo-title">
					<view class="left-item">
						<image src="/static/common/icon_lb.png" class="reservationInfo-icon"></image>
						<view>已预约人员列表({{coursePreDetail.list.total || ""}})</view>
					</view>
				</view>
			</view>
			<view class="reservationInfo-list">
				<view class="reservationInfo-item" v-for="(item,index) in coursePreDetail.list.data" :key="index">
					<image :src="item.avatar" class="item-left"></image>
					<view class="item-center">
						<view class="item-user">
							<view class="item-name">ID：{{item.nickname}} </view>
							<view class="item-phone">{{item.mobile}}</view>
						</view>
						<view class="item-time">预约时间：{{item.day}}</view>
					</view>
					<view class="item-right">
						<view class="button button1" v-if="item.status==0">未核销 </view>
						<view class="button button3" v-if="item.status==1">已核销</view>
						<view class="button button3" v-if="item.status==2">已取消</view>
					</view>
				</view>
			</view>
		</z-paging>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				dataList: [],
				card_id: null,
				coursePreDetail: null
			}
		},
		onLoad(options) {
			if (options && options.card_id) {
				this.card_id = options.card_id
				this.coursePreInfo()
			}
		},
		methods: {
			coursePreInfo() {
				this.$Api.user.coursePreInfo({
					card_id: this.card_id,
				}).then(res => {
					this.coursePreDetail = res.data
				})
			}
		}
	}
</script>

<style lang="scss" scoped>
	.reservationInfo-page {
		width: 100%;
		min-height: 100vh;
		background: #F6F6F8;

		.courses-info {
			margin: 20rpx 30rpx;
			border-radius: 28rpx;
			padding: 20rpx 22rpx;
			display: flex;
			align-items: center;
			background: #ffffff;

			.item-left {
				width: 156rpx;
				height: 156rpx;
				margin-right: 20rpx;
			}

			.item-right {
				flex: 1;
				height: 156rpx;
				display: flex;
				flex-direction: column;
				justify-content: space-between;

				.courses-title {
					font-weight: bold;
					font-size: 32rpx;
				}

				.courses-surplus {
					font-size: 26rpx;
					color: #565656;
				}
			}


		}

		.reservationInfo-title {
			margin: 22rpx 30rpx 20rpx;
			display: flex;
			align-items: center;
			justify-content: space-between;
			font-size: 28rpx;
			color: #000000;

			.left-item {
				display: flex;
				align-items: center;
				font-weight: bold;
			}

			.reservationInfo-icon {
				width: 24rpx;
				height: 24rpx;
				margin-right: 12rpx;
			}
		}

		.reservationInfo-list {
			margin: 0rpx 30rpx;

			.reservationInfo-item {
				display: flex;
				align-items: center;
				margin-bottom: 20rpx;
				box-sizing: border-box;
				padding: 26rpx 20rpx;
				box-shadow: 0rpx 0rpx 12rpx 0rpx rgba(0, 0, 0, 0.1), inset 0rpx 2rpx 2rpx 0rpx #FFFFFF;
				border-radius: 28rpx;
				background: #ffffff;

				.item-left {
					width: 88rpx;
					height: 88rpx;
					border-radius: 50%;
					margin-right: 20rpx;
				}

				.item-center {
					flex: 1;
					height: 88rpx;
					display: flex;
					flex-direction: column;
					justify-content: space-between;

					.item-user {
						display: flex;
						align-items: center;
					}

					.item-time {
						font-size: 26rpx;
						color: #9A9A9A;
					}
				}

				.item-right {
					min-width: 200rpx;
					min-height: 156rpx;
					display: flex;
					flex-direction: column;
					justify-content: space-around;
					align-items: flex-end;

					.button {
						width: 156rpx;
						height: 56rpx;
						font-weight: bold;
						font-size: 28rpx;
						line-height: 56rpx;
						text-align: center;
						border-radius: 44rpx;
					}

					.button1 {
						color: #FFB900;
						background: #FFF8E5;
						border: 1rpx solid #FFB900;
					}

					.button2 {
						color: #A3C616;
						background: #FBFFED;
						border: 1rpx solid #A3C616;
					}

					.button3 {
						color: #DADADA;
						background: #F9F9F9;
						border: 1rpx solid #E5E5E5;
					}
				}
			}
		}
	}
</style>